/***************************************************************************
 *   Copyright (C) 2008 by Eduardo Gurgel Pinho                            *
 *   edgurgel@gmail.com                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/

#ifndef __TGA_H__
#define __TGA_H__

#include <boost/serialization/nvp.hpp>

#include "image.h"
#include "color.h"

namespace Sirat {

namespace Common {

/**
 * .tga Image implementation.
 */
	
class Tga : public Image {
public:
	/**
	 * Simple constructor.
	 * @param _height 
	 * @param _width 
	 */
	Tga(const unsigned int _width,const unsigned int _height);
	
	/**
	 * Default Constructor
	 */
	Tga();
	
	/**
	 * Copy Constructor
	 * @param _tga 
	 */
	Tga(const Tga& _tga);
	
	/**
	 * Destructor.
	 */
	~Tga();


	/**
	 * Saving tga. Here the file is saved as "'_file'.tga".
	 * @param _file Filename
	 */
	virtual void save_file(const char* _file);
	
	/**
	 * Loading TGA.
	 * @param _file Filename
	 */
	virtual void load_file(const char* _file);
	
	Tga& operator=(const Tga& _tga);
	
	Tga* operator+(const Tga* const) const;
	
private:
	friend class boost::serialization::access;
	template<class Archive> void serialize(Archive&, const unsigned int);
	
	unsigned int size, line_size;
	char* data;
};



template<class Archive> void Tga::serialize(Archive& ar, const unsigned int /* file_version */){
	ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Image);
}

}

}

#endif
